function SegmentedRectModel (height, width, depth, segmentW, segmentH, segmentD) {
	if (this instanceof arguments.callee) {
		throw new Error("bleh");
	}

	var ret = new Model();
	var push = function(a, b, c, d, e, f) { ret.pushVertex([a, b, c], [d, e, f], [b == 0 ? 1 : 0]); };
	var pushT = function(a, b, c, d, e, f) { ret.pushVertex([a, b, c], [d, e, f], [b == 0 ? 1 : 0, 1]); };
	// Back
	for (var i = 0; i < segmentW; i++) {
		for (var j = 0; j <= segmentH; j++) {
			push(i * width / segmentW, j * -height / segmentH, -depth, 0, 0, -1);
			push((i + 1) * width / segmentW, j * -height / segmentH, -depth, 0, 0, -1);
		}
	}

	// Front
	for (var i = 0; i < segmentW; i++) {
		for (var j = 0; j <= segmentH; j++) {
			push(i * width / segmentW, j * -height / segmentH, depth, 0, 0, 1);
			push((i + 1) * width / segmentW, j * -height / segmentH, depth, 0, 0, 1);
		}
	}

	// Left
	for (var i = 0; i < segmentH; i++) {
		for (var j = 0; j <= segmentD; j++) {
			push(0, i * -height / (segmentH - 1), 2 * j * depth / segmentD - depth, 1, 0, 0);
			push(0, (i + 1) * -height / (segmentH - 1), 2 * j * depth / segmentD - depth, 1, 0, 0);
		}
	}

	// Right
	for (var i = 0; i < segmentH; i++) {
		for (var j = 0; j <= segmentD; j++) {
			push(width, i * -height / (segmentH - 1), 2 * j * depth / segmentD - depth, -1, 0, 0);
			push(width, (i + 1) * -height / (segmentH - 1), 2 * j * depth / segmentD - depth, -1, 0, 0);
		}
	}

	// Top
	for (var i = 0; i < segmentW; i++) {
		for (var j = 0; j <= segmentD; j++) {
			pushT(i * width / segmentW, 0, 2 * j * depth / segmentD - depth, 0, 1, 0);
			pushT((i + 1) * width / segmentW, 0, 2 * j * depth / segmentD - depth, 0, 1, 0);
		}
	}

	// Bottom
	for (var i = 0; i < segmentW; i++) {
		for (var j = 0; j <= segmentD; j++) {
			push(i * width / segmentW, -height, 2 * j * depth / segmentD - depth, 0, -1, 0);
			push((i + 1) * width / segmentW, -height, 2 * j * depth / segmentD - depth, 0, -1, 0);
		}
	}

    ret.draw = function(camera) {
		this.prepareDraw(camera);
		var p = 0;
		var drawNext = function(r, n) {
			for (var i = 0; i < r; i++) {
				gl.drawArrays(gl.TRIANGLE_STRIP, p, n); p += n;
			}
		};
		drawNext(segmentW * 2, (segmentH + 1) * 2);
		drawNext(segmentW * 2, (segmentD + 1) * 2);
		drawNext(segmentH * 2, (segmentD + 1) * 2);
	}

	ret.initBuffers();
	return ret;
}
